package cn.itcast.controller;

import cn.itcast.pojo.ClazzBean;
import cn.itcast.pojo.Result;
import cn.itcast.service.ClazzService;
import cn.itcast.service.EmpService;
import cn.itcast.service.StudentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private EmpService empService;
    @Autowired
    private StudentsService studentsService;
    @Autowired
    private ClazzService clazzService;
    /*@GetMapping("/empGenderData")
    public Result empGenderData(){
        return empService.empGenderData() == null ? Result.error("查询失败") : Result.success("查询成功", empService.empGenderData());
    }
    @GetMapping("/empJobData")
    public Result empJobData(){
        return empService.empJobData() == null ? Result.error("查询失败") : Result.success("查询成功", empService.empJobData());
    }*/
    @GetMapping("/studentDegreeData")
    public Result studentDegreeData(){
        return studentsService.studentDegreeData() == null ? Result.error("查询失败") : Result.success("查询成功", studentsService.studentDegreeData());
    }
    @GetMapping("/studentCountData")
    public Result studentCountData() {
        ClazzBean result = clazzService.studentCountData();
        return result.getClazzList().size() == 0 || result.getDataList().size() == 0? Result.error("查询失败") : Result.success("查询成功", result);
    }
}
